<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<input type="button" id="findById" value="查询对象" >
	<table id="xx" border="1" width="500" cellpadding="10" cellspacing="0">
		<tr>
			<td>用户名</td>
			<td>年龄</td>
		</tr>
	</table>
</body>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.7.2.js" ></script>
	<script type="text/javascript">
		$(function(){
			$('#findById').click(function(){
				$.ajax({
					type:'POST',
					url:'${pageContext.request.contextPath}/findById',
					dataType:'json',
					success:function(entity){
						var username = entity.username;
						var age = entity.age;
						var tr=$('<tr><td>'+username+'</td><td>'+age+'</td></tr>');
						$('#xx').append(tr);
					}
				});
			});
		});
	</script>
</html>